<template>
  <div class="doubtPage cancelPadding secondary-page-mode">
      <div class="secondary-toolbar">
           <span>日期 : </span>
           <div class="layoutBox" style="width:242px">
            <el-date-picker v-model="dateRange" type="daterange" start-placeholder="开始日期" end-placeholder="结束日期" value-format="yyyy-MM-dd"></el-date-picker>
          </div>&emsp;&emsp;
            <el-button @click="getTableData"><i class="iconfont icon-sousuo"></i>查询</el-button>
         
      </div>
      <div class="currency-mode-wrap">
            <el-table
              :data="tableData"
              border
              style="height: calc(100% - 35px)">
              <el-table-column
                type="index"
                label="序号"
                :index="indexMethod"
                style='height:calc(100% - 38px)'>
              </el-table-column>
              <el-table-column
                label="断面名称">
                  <template  slot-scope="scope">
                      <p>{{scope.row.dataAudit.stationName}}</p>
                  </template>
              </el-table-column>
               <el-table-column
                label="运维单位">
                 <template  slot-scope="scope">
                      <p>{{scope.row.dataAudit.stationCompany}}</p>
                  </template>
              </el-table-column>
               <el-table-column
                label="监测时间" width='180px'>
                  <template  slot-scope="scope">
                      <p>{{scope.row.dataAudit.createTime}}</p>
                  </template>
              </el-table-column>
               <el-table-column
                label="监测参数">
                 <template  slot-scope="scope">
                      <p>{{scope.row.dataAudit.projName}}</p>
                  </template>
              </el-table-column>
               <el-table-column
                prop=""
                label="监测值">
                     <template  slot-scope="scope">
                      <p>{{scope.row.dataAudit.projValue}}</p>
                     </template>
              </el-table-column>
              
               <el-table-column
                prop="auditUser"
                label="标记人员">
              </el-table-column>
               <el-table-column
                prop="auditDesc"
                label="存疑描述">
              </el-table-column>
               <el-table-column
                prop="auditConDesc"
                label="审核描述">
              </el-table-column>
            </el-table>
            <div class="paginationBox">
              <el-pagination
                @size-change="paginationSizeChange"
                @current-change="paginationChange"
                :current-page.sync="currentPage"
                :page-size="pageSize"
                background
                :small = "true"
                popper-class = "select-common-option"
                :page-sizes = "pageList"
                layout="total,sizes,slot,->,prev, pager, next, jumper"
                :total="totalRecords">
                 <span class="el-pagination__current">当前第{{currentPage}}/{{totalPage}}页</span>
              </el-pagination>
            </div>
      </div>
  </div>
</template>

<script>
export default {
  name: "",
  data() {
    return {
      dateRange: [],
      tableData: [],
      stationMnList:[],
      currentPage: 1, //分页组件当前页
      pageSize: 10, //分页每页多少条数据
      totalRecords: 0, //总条数
      pageList: [10, 15, 20] //设置每页多少条
    };
  },
  created() {
    this.setDate();
    
  },
  methods: {
    paginationChange(val) {
      //分页页码改变时执行
      this.currentPage = val;
       this.getTableData()
    },
    paginationSizeChange(val) {
      //分页pageSize改变时执行
      this.pageSize = val;
      this.getTableData()
    },
    setDate(){
      let d = new Date().setDate(new Date().getDate() - 7);
      let date = new Date(d).format("yyyy-MM-dd");
      this.dateRange = [date, new Date().format("yyyy-MM-dd")];
    },
    indexMethod(index) {
      return index + 1;
    },
    getTableData(){
        this.$http.post('/DataAudit/dataAudit/doubtataAuditPage',{
          "startTime":this.dateRange[0] + ' 00:00:00',
          "endTime":this.dateRange[1] + ' 23:59:59',
          "auditOperation":'',
          "mn":'',
          'stationMnList':this.stationMnList,
          "page":true,
          "pageObject":{
          	"pageNumber":this.currentPage,
          	"pageSize":this.pageSize
          }
        }).then((res)=>{
            if(res.data.code == 0){
                this.tableData=res.data.content.dataList;
                this.totalRecords=res.data.content.totalRecords;
            }
        })
    }
  },
  computed: {
    totalPage() {
      let number = 0;
      number = Math.ceil(this.totalRecords / this.pageSize);
      return number;
    },
    stationInfo: {
      get: function() {
        return this.$store.state.stationInfo;
      }
    }
  },
   watch: {
    stationInfo: function(newValue, oldValue) {
      if (newValue.length>0) {
          let arr=[];
          for(let i=0;i<newValue.length;i++){
            arr.push(newValue[i].nodeId)
          };
       
          this.stationMnList=arr;
          this.getTableData()
      }
    }
  }
};
</script>

<style scoped lang="less">
.doubtPage {
  height: 100%;
}
</style>
